#ifndef T_PCM_AUDIO_DEVICE_H
#define T_PCM_AUDIO_DEVICE_H

#include <QtCore>

struct T_PCM_AudioDeviceSpec
{
    quint32 nSamplesPerSec;
    quint16 nBitsPerSample;
    quint16 nChannels;
    quint16 nSampleUnit;	/**< Audio buffer size in samples (power of 2) */
    quint8  nSilence;		/**< Audio buffer silence value (calculated) */
    quint32 nSampleSize;	/**< Audio buffer size in bytes (calculated) */
};

class T_PCM_AudioDevicePrivate;
class T_PCM_AudioDevice : public QObject
{
    Q_OBJECT
public:
    T_PCM_AudioDeviceSpec m_spec;
    int enabled;
    int paused;
    int opened;
    explicit T_PCM_AudioDevice(QObject *parent = 0);
    ~T_PCM_AudioDevice();
    int OpenAudio(T_PCM_AudioDeviceSpec *spec);
    quint8 *GetAudioBuf();
    void PlayAudio();
    void WaitAudio();
    void WaitDone();
    void CloseAudio();

    T_PCM_AudioDevicePrivate * d_ptr;
    Q_DECLARE_PRIVATE(T_PCM_AudioDevice)
};

#endif /* T_PCM_AUDIO_DEVICE_H */
